lambda lifting - définition. Qu'est-ce que lambda lifting
Diclib.com
Dictionnaire ChatGPT
Entrez un mot ou une phrase dans n'importe quelle langue 👆
Langue:

Traduction et analyse de mots par intelligence artificielle ChatGPT

Sur cette page, vous pouvez obtenir une analyse détaillée d'un mot ou d'une phrase, réalisée à l'aide de la meilleure technologie d'intelligence artificielle à ce jour:

  • comment le mot est utilisé
  • fréquence d'utilisation
  • il est utilisé plus souvent dans le discours oral ou écrit
  • options de traduction de mots
  • exemples d'utilisation (plusieurs phrases avec traduction)
  • étymologie

Qu'est-ce (qui) est lambda lifting - définition

META-PROCESS THAT DEFINES FUNCTIONS INDEPENDENTLY OF EACH OTHER IN A GLOBAL SCOPE
Lambda Lifting; Lambda lift; Closure conversion; Λ-lifting

lambda lifting         
A program transformation to remove free variables. An expression containing a free variable is replaced by a function applied to that variable. E.g. f x = g 3 where g y = y + x x is a free variable of g so it is added as an extra argument: f x = g 3 x where g y x = y + x Functions like this with no free variables are known as supercombinators and are traditionally given upper-case names beginning with "$". This transformation tends to produce many supercombinators of the form f x = g x which can be eliminated by eta reduction and substitution. Changing the order of the parameters may also allow more optimisations. References to global (top-level) constants and functions are not transformed to function parameters though they are technically free variables. A closely related technique is closure conversion. See also Full laziness.
Lambda lifting         
Lambda lifting is a meta-process that restructures a computer program so that functions are defined independently of each other in a global scope. An individual "lift" transforms a local function into a global function.
closure conversion         
<theory> The transformation of continuation passing style code so that the only free variables of functions are names of other functions. See also Lambda lifting. (1994-12-16)

Wikipédia

Lambda lifting

Lambda lifting is a meta-process that restructures a computer program so that functions are defined independently of each other in a global scope. An individual "lift" transforms a local function into a global function. It is a two step process, consisting of;

  • Eliminating free variables in the function by adding parameters.
  • Moving functions from a restricted scope to broader or global scope.

The term "lambda lifting" was first introduced by Thomas Johnsson around 1982 and was historically considered as a mechanism for implementing functional programming languages. It is used in conjunction with other techniques in some modern compilers.

Lambda lifting is not the same as closure conversion. It requires all call sites to be adjusted (adding extra arguments to calls) and does not introduce a closure for the lifted lambda expression. In contrast, closure conversion does not require call sites to be adjusted but does introduce a closure for the lambda expression mapping free variables to values.

The technique may be used on individual functions, in code refactoring, to make a function usable outside the scope in which it was written. Lambda lifts may also be repeated, in order to transform the program. Repeated lifts may be used to convert a program written in lambda calculus into a set of recursive functions, without lambdas. This demonstrates the equivalence of programs written in lambda calculus and programs written as functions. However it does not demonstrate the soundness of lambda calculus for deduction, as the eta reduction used in lambda lifting is the step that introduces cardinality problems into the lambda calculus, because it removes the value from the variable, without first checking that there is only one value that satisfies the conditions on the variable (see Curry's paradox).

Lambda lifting is expensive on processing time for the compiler. An efficient implementation of lambda lifting is O ( n 2 ) {\displaystyle O(n^{2})} on processing time for the compiler.

In the untyped lambda calculus, where the basic types are functions, lifting may change the result of beta reduction of a lambda expression. The resulting functions will have the same meaning, in a mathematical sense, but are not regarded as the same function in the untyped lambda calculus. See also intensional versus extensional equality.

The reverse operation to lambda lifting is lambda dropping.

Lambda dropping may make the compilation of programs quicker for the compiler, and may also increase the efficiency of the resulting program, by reducing the number of parameters, and reducing the size of stack frames. However it makes a function harder to re-use. A dropped function is tied to its context, and can only be used in a different context if it is first lifted.